home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / win / pbbsw35a.zip / DISK1.PWR / POWRDLL.PAS < prev    next >
Pascal/Delphi Source File  |  1994-06-25  |  48KB  |  1,316 lines

  1. {$M 20000, 20000}
  2. library PowrDll;
  3. { PowerBBS Development Add-On DLL }
  4. { (c) 1994 by Russell E. Frey     }
  5.  
  6. { This source code may be freely distributed. }
  7. { You may create a 3rd party DLL add-on to PowerBBS, and
  8.   distribute it ROYALTY FREE. }
  9.  
  10. { You may even modify this code and distribute it, so long as you
  11.   note the modifications at the top of the code and keep ALL the
  12.   comments here at the top.}
  13.  
  14. { Be sure to announce your product on our BBS: 516-822-7396 and/or
  15.   distribute shareware versions of your DLL on our BBS.  We will do
  16.   our best to help you distribute your product! }
  17.  
  18. { If you translate this code to a different language, please consider
  19.   making your translation FREEWARE and upload it to the BBS.  Be sure
  20.   to thoroughly debug your translation (you do not want to mess up
  21.   the users record or they will not be happy!) }
  22.  
  23. { Sample code in Borland Pascal 7.0 on writing an add-on DLL for PowerBBS }
  24.  
  25. { This code can easily be translated to ANY language capable of writing a DLL }
  26. { To run this DLL, in PowerBBS MENU SETUP at the CGM option place a D [For
  27.   DLL!].  Then in the description of command put the NAME of the actual
  28.   DLL created.  For example this file: POWRDLL.DLL would be placed in
  29.   the description.
  30.  
  31.   When a user now selects the command PowerBBS will dynamically load
  32.   POWRDLL.DLL.  It will execute VERY FAST.  This is an easy way to create
  33.   a 3rd party add-on as if it was written inside of PowerBBS!  The user
  34.   will notice NO SLOWDOWN! }
  35.  
  36. { PowerLang's RUN_DLL command may also be used to execute the DLL }
  37.  
  38. { We welcome ALL your comments on the Power of PowerBBS's DLL }
  39. { We also welcome any questions you might have, but due to time }
  40. { constraints may not be able to help you in some cases (including
  41.   debugging your code, etc). }
  42.  
  43. { Be aware that this product is provided AS IS.  We are not
  44.   liable for ANY problems this DLL may cause. }
  45.  
  46. uses
  47.   WinDos,
  48.   Strings,
  49.   WinProcs,
  50.   WinTypes;
  51.  
  52. { Need Colors?  Use the following in your Print_Modem calls:
  53.  
  54.   AFTER calling the CONVERT_MACROS procedure!
  55.  
  56.   @1@ Blue
  57.   @2@ Green
  58.   @3@ Cyan
  59.   @4@ Red
  60.   @5@ Magenta
  61.   @6@ Gray
  62.   @7@ Yellow
  63.   @8@ Brown
  64.   @9@ White
  65.   @10@ Light Blue
  66.   @11@ Light Green
  67.   @12@ Light Cyan
  68.   @13@ Light Red
  69.   @14@ Light Magenta
  70.   @15@ Light Gray
  71.   @16@ Default Color
  72.  
  73.   Colors will ONLY be used if the caller has ANSI capabilities.
  74. }
  75.  
  76. {-----------------------------------------------------------------------------}
  77. { User types to directly manipulate user information.                         }
  78. { NEVER MANIPULATE any information unless you are SURE of what you are doing! }
  79. {-----------------------------------------------------------------------------}
  80. Type
  81.    packed_2_chars  = array[1..2] of char;
  82.    packed_3_chars  = array[1..3] of char;
  83.    packed_4_chars  = array[1..4] of char;
  84.    packed_5_chars  = array[1..5] of char;
  85.    packed_6_chars  = array[1..6] of char;
  86.    packed_7_chars  = array[1..7] of char;
  87.    packed_8_chars  = array[1..8] of char;
  88.    packed_9_chars  = array[1..9] of char;
  89.    packed_10_chars = array[1..10] of char;
  90.    packed_11_chars = array[1..11] of char;
  91.    packed_12_chars = array[1..12] of char;
  92.    packed_13_chars = array[1..13] of char;
  93.    packed_14_chars = array[1..14] of char;
  94.    packed_15_chars = array[1..15] of char;
  95.    packed_16_chars = array[1..16] of char;
  96.    packed_19_chars = array[1..19] of char;
  97.    packed_20_chars = array[1..20] of char;
  98.    packed_23_chars = array[1..23] of char;
  99.    packed_24_chars = array[1..24] of char;
  100.    packed_25_chars = array[1..25] of char;
  101.    packed_30_chars = array[1..30] of char;
  102.    packed_39_chars = array[1..39] of char;
  103.    packed_40_chars = array[1..40] of char;
  104.    packed_32_chars = array[1..32] of char;
  105.    packed_35_chars = array[1..35] of char;
  106.    packed_45_chars = array[1..45] of char;
  107.    packed_78_chars = array[1..78] of char;
  108.    packed_128_chars = array[1..128] of char;
  109.  
  110.   {Specification of the PowerUser_Rec. variable which stores the current
  111.    users information.}
  112.  pPowrUser_Record = ^PowrUser_Record;
  113.   PowrUser_Record = record
  114.          name:                packed_25_chars;    {Name}
  115.          Location:            packed_20_chars;    {City/Location}
  116.          Computer:            packed_15_chars;    {Computer Type}
  117.          Phone_Number:        packed_14_chars;    {Phone Number} {Home}
  118.          Password:            packed_10_chars;    {Password}
  119.          Birthday:            packed_8_chars;     {Date of birthday, DD/MM/YY}
  120.          First_Call:          packed_8_chars;     {Date of first call, DD/MM/YY}
  121.          Last_File_Scan:      packed_8_chars;     {Date of last file search, DD/MM/YY}
  122.          Expiration_Date:     packed_8_chars;     {Expiration Date}
  123.          Last_Call:           packed_8_chars;     {Date of last call, DD/MM/YY}
  124.          Last_Time:           packed_5_chars;     {Time of last call, HH:MM}
  125.          Calls:               integer;    {Total number of calls}
  126.          uploads:             integer;    {Total number of uploads}
  127.          downloads:           integer;    {Total number of downloads}
  128.          Time_On:             integer;    {Minutes used TODAY}
  129.          Today_Bytes:         double;     {Bytes downloaded TODAY}
  130.          Download_Bytes:      double;     {Total bytes downloaded}
  131.          Upload_Bytes:        double;     {Total bytes uploaded}
  132.          JUNK:                array[1..820] of byte;
  133.          Qwk_Init:            byte;
  134.          QWK_Flag1,
  135.          QWK_Flag2:           byte;
  136.          QWK_Flag3,
  137.          QWK_Flag4:           word;
  138.          internaluse:         byte;
  139.          waiting_messages:    word; { number of messages waiting }
  140.          reservedb:           byte;
  141.          reservedl:           longint;
  142.          handle_new:           byte;
  143.          info_in_new_numbs:    byte; {if<>200 then just junk in next fields:}
  144.          chat_use_handle:      boolean;
  145.          qwk_msg_use_handle:   boolean;
  146.          data_phone:           packed_14_chars;
  147.          business_number:      packed_14_chars;
  148.          fax_number:           packed_14_chars;
  149.  
  150.          bchat_exit:           Byte; {if=200 use string}
  151.          chat_exit:           String[60];
  152.          bchat_entry:          Byte; {if=200 use string}
  153.          chat_entry:          String[60];
  154.          Access:              Byte;       {Access Level}
  155.          Expiration_Access:   Byte;       {Expired Access Level}
  156.          Screen_Lines:        Byte;       {Length of a page}
  157.          Safe_Total:          Byte;       {Time in Bank}
  158.          Options:             byte;       {Option bits}
  159.           {bit value 1 = expert; 4 = dead; 8 = hasmail; 16=TRUE,64=TRUE then 32=TRUE[MALE];FALSE[FEMALE]}
  160.          Xproto:              Char;       {Protocol}
  161.          Monitor_Type:        Char;       {Monitor? (M)onocrome (C)olor (N)one}
  162.          Messages_Left:       word;       {total messages left by user}
  163.          downbytes_month:     double;           {total bytes downloaded/month}
  164.          downbytesmonth:      byte;
  165.          downbytes_month_max: word;             {max downbytes/month}
  166.          truebps2:            packed_5_chars;   {true baud rate}
  167.          lang_num:            byte;             {current language number}
  168.          is_focused:          boolean;              {used internally}
  169.          powercomm_connect:   boolean;              {true if PowerComm
  170.                                                      connect}
  171.          color_mode_connect:  boolean;              {true if PowerComm/
  172.                                                      color_mode connect}
  173.          last_forum_on2:      byte;                 {last forum joined}
  174.          credits:             longint;              {amount of credits left}
  175.          anony_name2:         string[15];           {JUNK}
  176.          script:              array[1..37] of char; {used for scripts}
  177.          auto_forum_join_set: char; { = 10 means use auto forum join! }
  178.          auto_forum_join:     integer;
  179.          set_up_int_msgs:     byte;   { = 10 if use next two options! }
  180.          max_internet_msgs_month: word;
  181.          current_internet_msgs_month: word;
  182.          the_internet_month: byte;
  183.  
  184.          allow_FTPmail:       byte;   {allow if = 10}
  185.          dollars:             word;
  186.          call_verified:       byte;
  187.          anonymous_name:      array[1..20] of char;
  188.          has_anonyname:       char; { if true, set to 10 }
  189.          has_address:         char; { if true, set to 10 }
  190.          last_menu_code:      byte;
  191.          QWK_Net_User:        byte; { if true, set to 10 }
  192.          area_backnum:        array[1..3] of char;
  193.          last_forum_on:       integer;
  194.          created_rec:         char; { if true, set to 10 }
  195.          PowerUser_Ext_Num:   word;
  196.  
  197.          address:             array[1..50] of char; {address} {location above}
  198.          state:               array[1..10] of char;  {state}
  199.          zip:                 array[1..10] of char; {zip}
  200.  
  201.          call_backnum:        array[1..7] of char;  {Called Number}
  202.        end;
  203.  
  204.   { The following record holds the forum information (all 1000 forums) }
  205. const
  206.   highest_ext_forum_number = 999; { was 1000 }
  207.  
  208. type
  209.    { data structure for PowerUser_Rec.Forum }
  210.    forum_data_options_record = record
  211.       Options:    byte;            {Options}
  212.         {bit value 1 = member
  213.                    2 = 2
  214.              16= join_it}
  215.       Message_Pointer: single;     {Pointer to message last read}
  216.    end;
  217.  
  218.   Array_Of_Forum_Ext = array[0..highest_ext_forum_number] of forum_data_options_record;
  219.  
  220.  pPowrUser_Record_Extension = ^PowrUser_Record_Extension;
  221.   PowrUser_Record_Extension = record
  222.     Delete_This:  boolean;
  223.     Forum_Data:   Array_Of_Forum_Ext;       {0..999}
  224.     user_name:    longint;    { 32 bit CRC of user name }
  225.     junk:         byte;
  226.   end;
  227.  
  228.   {Specification of the Power_CallInfo_Rec; holds the current caller's
  229.    information (The USERINFO.BBS File) }
  230.  pPower_CallInfo_Rec = ^Power_CallInfo_Rec;
  231.   Power_CallInfo_Rec = record
  232.     name:             packed_25_chars;         {User Name}
  233.     User_Pointer:     integer;        {User Record # starting at 1}
  234.     BaudRate:         packed_5_chars;          {Baud Rate to Send at}
  235.     Com_Number:       char;           {Com Number to Send at}
  236.     What_Menu:        byte;           {Current Menu}
  237.     color_mode:         char;           {Gcolor_modeType:
  238.                                         'C' => Color
  239.                                         'M' => Monochrome
  240.                                         'N' => None}
  241.     Access:           byte;           {User Access Level}
  242.     ForumNum2:         byte;          {Current Forum Number}
  243.     Logon_Time:       packed_5_chars;          {hh:mm Time of Logon}
  244.     Logon_Mins:       integer;        {Time the user logged on in mins}
  245.     Used_Today:       integer;        {Time the user used in
  246.                                         previous calls so far today}
  247.     time_limit:       integer;        {Maximum mins permitted on BBS}
  248.     KDownload_Maximum:integer;        {Maximum download bytes in K}
  249.     Upload_Credit:    integer;        {Minutes given for Uploading}
  250.     Minutes_Useable:  integer;        {Maximum time left for Caller}
  251.     Node_Num:         byte;           {Node number of this CallInfo File}
  252.     Path_Data:        String[28];     {Path to PowrBBS.DAT}
  253.     Forum_Num:        integer;
  254.     Whatsdoing2:      char;           {'P' - Live Program
  255.                                        'G' - Goodbye after transfer
  256.                                        'T' - Transfer}
  257.     Trans_Type:       char;           {set to U for upload or D for download}
  258.     Protocol:         byte;           {protocol # for transfers}
  259.     Started:          longint;        {transfer, 'P' - Live Program}
  260.   end;
  261.  
  262.    { structure of the forum setup }
  263.   pPowerBBS_Forum_Structure = ^PowerBBS_Forum_Structure;
  264.    PowerBBS_Forum_Structure = record
  265.       forum_name:              string[20];          {name of forum}
  266.       forum_subsysop:          packed_23_chars;     {sub-sysop if any}
  267.       is_anonymous:            boolean;             {true if anonymous
  268.                                                      messages may be entered}
  269.       all_messages_public:     boolean;             {true if no private mail}
  270.       forum_public:            boolean;             {true if open to all users}
  271.       forum_min_access_level:  integer;             {min access needed for
  272.                                                      forum no matter what}
  273.       forum_messagebase_path:  string[31];          {path/filename of message
  274.                                                      base file}
  275.       forum_newsfile:          string[31];          {path/filename to news}
  276.       forum_filelisting:       string[31];          {path/filename to listing
  277.                                                      of file areas available}
  278.       forum_filelisting_data:  string[31];          {path/filename to data
  279.                                                      file containing
  280.                                                      information as to where
  281.                                                      file lists are}
  282.       forum_download_dirs:     string[31];          {list of download
  283.                                                      directories, that one
  284.                                                      may access to download
  285.                                                      files from}
  286.       forum_upload_directory:  string[31];          {upload directory}
  287.       forum_upload_listing:    string[31];          {listing of uploaded
  288.                                                      files}
  289.    end;
  290.  
  291.  { MOST of the information located in the PowrBBS.Dat file }
  292.  { Note that MANY variables contained in this record may contain JUNK
  293.    or is part of something else used in PowerBBS.Dat.  Be careful
  294.    with what you use! }
  295. string30 = string[30];
  296. string55 = string[55];
  297. string90 = string[90];
  298. string100 = string[100];
  299. filename_type = string[50];
  300. pbbs_record = ^bbs_record;
  301.  bbs_record = record
  302.    BBS_Name:                        String30;
  303.    Sysop_FirstName:                 String[10];
  304.    Sysop_Last_Name:                 String[15];
  305.    end_default:                     string[4];
  306.    MAX_Obey_Ratio:                  Integer;
  307.    Min_Msgs_Ratio:                  Integer;
  308.    Min_Downfile_Ratio:              Integer;
  309.    Min_Downbyte_Ratio:              Integer;
  310.    Min_Msgs_Ratio2:                 Integer;
  311.    Min_Downfile_Ratio2:             Integer;
  312.    Min_Downbyte_Ratio2:             Integer;
  313.    New_User_Level:                  Integer;
  314.    Access_Level_Info:               String30;
  315.    Download_Restrict_File:          String30;
  316.    Upload_Access_File:              String30;
  317.    Users_Path:                      String30;
  318.    Users_Path2:                     String30;
  319.    Forum_Data_File:                 String30;
  320.    Protocolinfo_file:               String30;
  321.    Transfer_FileList_File:          String30;
  322.    Security_File:                   String30;
  323.    Transfer_Directory:              filename_type;
  324.    Activity_Log:                    String30;
  325.    Tranlog_Path:                    String30;
  326.    Opening:                         String30;
  327.    Hello:                           String30;
  328.    Birthday_File:                   String30;
  329.    Expired_File:                    String30;
  330.    Sysop_File:                      String30;
  331.    Forum_Menu:                      String30;
  332.    NewUser_Text:                    String30;
  333.    No_Sysop_Chat:                   String30;
  334.    enter_chat_file:                 String30;
  335.    exit_chat_File:                  String30;
  336.    Script_Text,QScript_File :        String30;
  337.    BadUsers_Names:                  String30;
  338.    Read_Help_File:                  String30;
  339.    Mail_Prefix:                     String[8];
  340.    Most_Msgs_Downloadable:          Integer;
  341.    OS_Shell_File:                   String30;
  342.    Begin_Download_File:             String30;
  343.    Begin_Upload_File:               String30;
  344.    Freefile_List:                   String30;
  345.    Start_Batch:                     String30;
  346.    Init_Modem_Command1,
  347.    Init_Modem_Command2:             String55;
  348.    Nodes_Users_Info:                String30;
  349.    chatstatfile:                    string30;
  350.    chattalkfile:                    string30;
  351.    onetoonefile:                    string30;
  352.    roominfofile:                    string30;
  353.    run_xmodem1k:                    string;
  354.    script_for_newusers:             string30;
  355.    answer_to_script:                string30;
  356.    credit_system:                   boolean;
  357.    more_credits:                    string30;
  358.    anony_info:                      string30;
  359.    runanonybbs:                     boolean;
  360.    lowbaudinfoscreen:               string30;
  361.    minimum_sec_to_abort_intro:      integer;
  362.    screen_enter_script_mode:        string30;
  363.    screen_end_script_mode:          string30;
  364.    Live_Programs_Menu:              string30;
  365.    Live_Programs_DataFile:          string30;
  366.    Chat_Help_File:                  string30;
  367.    Most_Lines_Msg:                  integer;
  368.    minimum_baud:                    longint;
  369.    Modem_Offhook:                   string30;
  370.    Read_Mail_Menu:                  string30;
  371.    aux_addr1:                       word;
  372.    cardtype:                        word;
  373.    cardseg:                         word;
  374. (* --------------------Event Information------------------------------*)
  375.    old_active_event:                Boolean;
  376.    old_time_of_event:               String[5];
  377.    old_Wait_For_Event:              Boolean;
  378. (* --------------------- Test Files ----------------------------------*)
  379.    TestFiles:                       Boolean;
  380.    TestBatch:                       String30;
  381.    TestFile1:                       String30;
  382.    TestFile2:                       String30;
  383. (*--------------------------------------------------------------------*)
  384.    Private_Uploads_Only:            Boolean;
  385.    Private_Upload_Directory:        String30;
  386.    Private_Upload_List:             String30;
  387.    Bulletins_Menu:                  String30;
  388.    Bulletins_Data:                  String30;
  389.    Baud_Rate_Open_At:               packed_5_chars;
  390.    LockBaud:                        boolean;
  391.    ClosedBBS:                       Boolean;
  392.    Port_Number,Port_Number2:        String[6];
  393.    Port_Number3:                    array[0..6] of char;
  394.    RingAnswer:                      boolean;
  395.    Max_Pause_Time:                  Integer;
  396.    UseRealName:                     Boolean;
  397.    AllowBadChars:                   Boolean;
  398.    Permit_Ansi_Messages:            Boolean;
  399.    News_New:                        Boolean;
  400.    Turn_Off_FreeCheck:              Boolean;
  401.    Minimum_Space_Uploads:           Integer;
  402.    Default_AnsiColor:               String[4];
  403.    Default_AnsiIntensity:           String[4];
  404.    Transfer_Figure_Time:            Real;
  405.    Pack_QWK_Files:                  String30;
  406.    View_ZIP_File:                   filename_type;
  407.    Test_ZIP_File:                   filename_type;
  408.    Bad_archive:                     filename_type;
  409.    IndexPath:                       string30;
  410.    IndexRamdiskPath:                string30;
  411.    StatsScreen:                     string30;
  412.    PowerInfoPath:                   string30;
  413.    SerialNumber:                    string;
  414.    AskBirthdate:                    boolean;
  415.    NonEchoChar:                     char;
  416.    DeleteDropUploads:               boolean;
  417.    FilesRatiosScreen:               string30;
  418.    LogFileName:                     String30;
  419.    TranString:                      String30;
  420.    NSPath:                          string30;
  421.    Monitor_File:                    string30;
  422.    PermitHandles:                   boolean;
  423.    FrontDoorBatch:                  string30;
  424.    QuitBatchFile:                   string30;
  425.    TheListPath:                     string30;
  426.    UpdateScreen:                    string30;
  427.    ClockScreen:                     string30;
  428.    QuestionClosed,AnswerClosed:     string30;
  429.    LangInfoFile:                    string30;
  430.    BadRatioFile:                    string30;
  431.    Source_MNU_POW_Dir:              string30;
  432.    irq_modem:                       string30;
  433.    modem_base1:                     word;
  434.    modem_base2:                     string30;
  435.    MultiLanguage:                   boolean;
  436.    UseDtr:                          boolean;
  437.    UsePowerMail:                    boolean;
  438.    UseFrontDoor:                    boolean;
  439.    Expiration_Warning:              string30;
  440.    PNET_Tagline:                    string[60];
  441.    MODEM_ATHO:                      string30;
  442.    date_format:                     byte;   { 0 = US MM-DD-YY; 1 = DD-MM-YY }
  443.    event_data_file:                 string30;
  444.    minimum_sec_new_files:           integer;
  445.    use_fax:                         boolean;
  446.    show_whose_online:               boolean;
  447.    show_dialog_on_startup:          boolean;
  448.    doorsys_path:                    string30;
  449.    track_gender:                    boolean;
  450.    Start_Up_Minimized:              boolean;
  451.    Internet_Connection:             boolean;
  452.    PowerBase_Code:                  string30;
  453.    SysopPage_DataFile:              string30;
  454.    TheWav:                          string100;
  455.    Bytes_upload_Credit:             Word;
  456.    Bytes_Dn_Up_Credit:              Word;
  457.    Credits_To_Uploader:             Word;
  458.    Caller_ID:                       Boolean;
  459.    Show_Stats:                      Boolean;
  460.    Minimum_Access_For_Internet:     Integer;
  461.    forum_network_file:              string30;
  462.    cbv_onoff,
  463.    blts_onoff:                      boolean;
  464.  
  465.    Caller_ID_Name:                  string100;
  466.    Caller_ID_Phone:                 string100;
  467.  
  468.    areacodefile: string100; {CALL1}
  469.    callbackfile: string100; {CALL2}
  470.    begincallback:string100; {CALL3}
  471.    badnumbers:   string100; {CALL4}
  472.    security_change: string100; {CALL5}
  473.    tempo: string;
  474.    Start_PowerBBS_Directory: string100;
  475.    lastdirl: string90;
  476.  
  477.    QWK_Blts,
  478.    QWK_NewFiles,
  479.    QWK_UpNewFiles,
  480.    QWK_ALLNewFiles,
  481.    QWK_GOODBYE,
  482.    QWK_NEWS,
  483.    QWK_WELCOME,
  484.    QWK_FileEnclos,
  485.    QWK_ALLFileEnclos,
  486.    QWK_PromptFileEnclos,
  487.    QWK_Logoff:            boolean;
  488.    QWK_MaxConf,
  489.    QWK_Max_QWK:           word;
  490.  
  491.    marked_mail:           string;
  492.    credit_name:           string30;
  493.    credit_bytes:          string30;
  494.  
  495.    temps1, temps2, temps3, temps4: string;
  496.    temps5:                         string;
  497.   end;
  498.  
  499. {-----------------------------------------------------------------------------}
  500. { Just conversions.  itoa and atoi in C.                                      }
  501. {-----------------------------------------------------------------------------}
  502. function int_to_asc (int: integer): string;
  503. { Converts an integer to string }
  504. var
  505.    tstr: string;
  506. begin
  507.    str(int, tstr);
  508.    int_to_asc := tstr;
  509. end;
  510.  
  511. function asc_to_int (InString:  String): integer;
  512. var
  513.    i:             integer;
  514.    value:         integer;
  515.    num:           String;
  516.  
  517. begin
  518.    num := '';
  519.    for i := 1 to length(InString) do
  520.       if (InString[i] >= '0') and (InString[i] <= '9') then
  521.          num := num + InString[i];
  522.  
  523.    if length(num) = 0 then
  524.       value := 0
  525.    else
  526.       val(num, value, i);
  527.  
  528.    asc_to_int := value;
  529. end;
  530.  
  531. {-----------------------------------------------------------------------------}
  532. { Sample procedures to interface with PowerBBS.                               }
  533. {-----------------------------------------------------------------------------}
  534.  
  535. {-----------------------------------------------------------------------------}
  536. Procedure Print_Modem(PBBSWin: HWND;
  537.                       ToWrite: String);
  538. { Prints the String TOWRITE to the screen and caller }
  539. var
  540.   pToWrite: array[0..254] of char;
  541.  
  542. begin
  543.   StrPcopy(pToWrite, ToWrite);
  544.   SendMessage(PBBSWin, WM_COMMAND, 10001, longint(@pToWrite));
  545. end;
  546.  
  547. {-----------------------------------------------------------------------------}
  548. Procedure Println_Modem(PBBSWin: HWND;
  549.                       ToWrite: String);
  550. { Prints the String TOWRITE followed by a carriage return to screen and caller }
  551. var
  552.   pToWrite: array[0..254] of char;
  553.  
  554. begin
  555.   StrPcopy(pToWrite, ToWrite+#13);
  556.   SendMessage(PBBSWin, WM_COMMAND, 10001, longint(@pToWrite));
  557. end;
  558.  
  559. {-----------------------------------------------------------------------------}
  560. Procedure Get_Enter_Key(PBBSWIN: HWND);
  561. { Outputs to the user to press their enter key, waits till its pressed,
  562.   and clears the output that says Press [Enter]: }
  563.  
  564. begin
  565.   SendMessage(PBBSWin, WM_COMMAND, 10002, 0);
  566. end;
  567.  
  568. {-----------------------------------------------------------------------------}
  569. Procedure Ask_User(PBBSWIN:    HWND;
  570.                    Var InputS: String;
  571.                    MaxIn:      Integer);
  572. { Inputs characters from a user. }
  573. var
  574.   pIn: Array[0..254] of char;
  575.  
  576. begin
  577.   StrPcopy(pIn, int_to_asc(MaxIn));
  578.   SendMessage(PBBSWIN, WM_COMMAND, 10003, longint(@pIn));
  579.   InputS := StrPas(pIn);
  580.   { Note that command 10003 you send PowerBBS the maximum number of
  581.     input chars.  It then uses this SAME pointer to send back the
  582.     actual input from the user. }
  583. end;
  584.  
  585. {-----------------------------------------------------------------------------}
  586. procedure clearscreen(PBBSWIN:  HWND);
  587. { Clears the ANSI screen }
  588.  
  589. begin
  590.   SendMessage(PBBSWIN, WM_COMMAND, 10004, 0);
  591. end;
  592.  
  593. {-----------------------------------------------------------------------------}
  594. function PauseStop(PBBSWIN: HWND): boolean;
  595. { this function will display ::: Pause [S]top, [C]ontinue ::: if
  596.   the user is beyond their max lines/page.  If the user presses
  597.   S to Stop this function returns TRUE.  Otherwise FALSE is
  598.   pressed }
  599. var
  600.   pIn: Array[0..254] of char;
  601.  
  602. begin
  603.   SendMessage(PBBSWIN, WM_COMMAND, 10005, longint(@pIn));
  604.   PauseStop := (pIn[0] = 'Y');
  605. end;
  606.  
  607. {-----------------------------------------------------------------------------}
  608. function Get_Key(PBBSWIN: HWND): char;
  609. { Waits for a key from the user.  Returns the key pressed (note that
  610.   if the carrier dropped carrier it returns char #255).
  611.   *RETURNS THE UPPERCASE CHARACTER OF KEYPRESSED*}
  612.  
  613. var
  614.   pIn: Array[0..5] of char;
  615.  
  616. begin
  617.   SendMessage(PBBSWIN, WM_COMMAND, 10006, longint(@pIn));
  618.   Get_Key := pIn[0];
  619. end;
  620.  
  621.  
  622. {-----------------------------------------------------------------------------}
  623. function Get_YN(PBBSWIN: HWND): boolean;
  624. { Waits until the user presses Yes or No.  (note that it COULD be
  625.   different from a Y if a different LANGUAGE is being used) }
  626. var
  627.   pIn: Array[0..5] of char;
  628.  
  629. begin
  630.   SendMessage(PBBSWIN, WM_COMMAND, 10007, longint(@pIn));
  631.   Get_YN := (pIn[0] = 'Y');
  632. end;
  633.  
  634. {-----------------------------------------------------------------------------}
  635. function Get_YesNoQ(PBBSWIN: HWND;
  636.                     TheQues: String;
  637.                     Default: Boolean): boolean;
  638. { Outputs the question THEQUES to the user.  Then waits for a Y/N answer,
  639.   with Default being the answer if the user presses the [ENTER] key.
  640.   Returns the result }
  641.  
  642. var
  643.   PIn: array[0..254] of char;
  644.  
  645. begin
  646.   if Default then
  647.     StrPcopy(Pin, 'Y'+TheQues)
  648.   else
  649.     strPcopy(Pin, 'N'+TheQues);
  650.   SendMessage(PBBSWIN, WM_COMMAND, 10008, longint(@pIn));
  651.   Get_YesNoQ := PIn[0] = 'Y';
  652. end;
  653.  
  654.  
  655. {-----------------------------------------------------------------------------}
  656. function Get_Hot(PBBSWIN: HWND;
  657.                  OKChars: String): Char;
  658. { Waits till the user presses a valid char in the OKChars string and
  659.   returns that char (note: may not return a valid char if the user
  660.   drops carrier).  Ex: Get_Hot(PBBSWIN, 'YN') to wait for Y or N.
  661.   Use UPPERCASE }
  662.  
  663. var
  664.   PIn: array[0..254] of char;
  665.  
  666. begin
  667.   StrPcopy(Pin, OKChars);
  668.   SendMessage(PBBSWIN, WM_COMMAND, 10009, longint(@pIn));
  669.   Get_Hot := PIn[0];
  670. end;
  671.  
  672. {-----------------------------------------------------------------------------}
  673. Procedure Type_File_To_Modem(PBBSWIN: HWND;
  674.                              FName:   String);
  675. { Types the file specified to the modem. }
  676.  
  677. var
  678.   PIn: array[0..254] of char;
  679.  
  680. begin
  681.   StrPcopy(Pin, Fname);
  682.   SendMessage(PBBSWIN, WM_COMMAND, 10010, longint(@pIn));
  683. end;
  684.  
  685. {-----------------------------------------------------------------------------}
  686. function Input_Key_Time(PBBSWIN:  HWND;
  687.                         MaxTime:  integer): char;
  688. { Waits up to MaxTime (in milliseconds) for a character to be entered.
  689.   If the user does NOT press a key in this time, character #255 is
  690.   returned. }
  691. var
  692.   PIn: array[0..254] of char;
  693.  
  694.  
  695. begin
  696.   StrPcopy(Pin, int_to_asc(MaxTime));
  697.   SendMessage(PBBSWIN, WM_COMMAND, 10011, longint(@PIn));
  698.   Input_Key_Time := PIn[0];
  699. end;
  700.  
  701. {-----------------------------------------------------------------------------}
  702. procedure Send_Modem_Command(PBBSWIN: HWND;
  703.                              commands:string);
  704. { Sends commands to the modem and does NOT print commands on the local
  705.   screen. }
  706. var
  707.   PIn: array[0..254] of char;
  708.  
  709.  
  710. begin
  711.   StrPcopy(PIn, commands);
  712.   SendMessage(PBBSWIN, WM_COMMAND, 10012, longint(@PIn));
  713. end;
  714.  
  715.  
  716. {-----------------------------------------------------------------------------}
  717. function No_User_Online(PBBSWIN: HWND): boolean;
  718. {        **************
  719.   This is an IMPORTANT function.  If this boolean is ever TRUE it should
  720.   be the end of your DLL!  So this NEEDS to be included in all loops,
  721.   repeats, etc.  If TRUE, then exit the loop, etc..  Example:
  722.     Repeat
  723.     Until (..) or (No_User_Online);
  724. }
  725. var
  726.   pIn: Array[0..5] of char;
  727.  
  728. begin
  729.   SendMessage(PBBSWIN, WM_COMMAND, 10013, longint(@pIn));
  730.   No_User_Online := (pIn[0] = 'Y');
  731. end;
  732.  
  733. {-----------------------------------------------------------------------------}
  734. procedure Execute_Prog(PBBSWIN: HWND;
  735.                        commands:string);
  736. {
  737.   Closes the com port.  Executes commands, re-opens, and returns.
  738. }
  739.  
  740. var
  741.   PIn: array[0..254] of char;
  742.  
  743.  
  744. begin
  745.   StrPcopy(PIn, commands);
  746.   SendMessage(PBBSWIN, WM_COMMAND, 10014, longint(@PIn));
  747. end;
  748.  
  749. {-----------------------------------------------------------------------------}
  750. function Key_Waiting(PBBSWIN: HWND): boolean;
  751. { Returns true if a key is waiting (could be either from the sysop's
  752.   local keyboard or remote }
  753. var
  754.   pIn: Array[0..5] of char;
  755.  
  756. begin
  757.   SendMessage(PBBSWIN, WM_COMMAND, 10015, longint(@pIn));
  758.   Key_Waiting := (pIn[0] = 'Y');
  759. end;
  760.  
  761. {-----------------------------------------------------------------------------}
  762. function Time_Left(PBBSWIN: HWND): integer;
  763. { Returns the time that the user has left }
  764. var
  765.   pIn: Array[0..254] of char;
  766.  
  767. begin
  768.   SendMessage(PBBSWIN, WM_COMMAND, 10016, longint(@pIn));
  769.   Time_Left := asc_to_int(StrPas(pIn));
  770. end;
  771.  
  772. {-----------------------------------------------------------------------------}
  773. Procedure Verify_Time_Left(PBBSWIN: HWND);
  774. { PowerBBS checks the time left by User.  If it is 0, the user is
  775.   told their time is out.   (No_User_Online would then be TRUE). }
  776.  
  777. begin
  778.   SendMessage(PBBSWIN, WM_COMMAND, 10017, 0);
  779. end;
  780.  
  781. {-----------------------------------------------------------------------------}
  782. Procedure Write_ActLog(PBBSWIN: HWND;
  783.                        ToWrite: String);
  784. { Writes TOWRITE to the activity Log }
  785. var
  786.   pIn: Array[0..254] of char;
  787.  
  788. begin
  789.   StrPcopy(pIn, ToWrite);
  790.   SendMessage(PBBSWIN, WM_COMMAND, 10019, longint(@pIn));
  791. end;
  792.  
  793. {-----------------------------------------------------------------------------}
  794. Procedure Convert_MACROS(PBBSWIN: HWND;
  795.                          Var ToConv:  String);
  796. { Converts all |MACROS| }
  797. var
  798.   pIn: Array[0..254] of char;
  799.  
  800. begin
  801.   StrPcopy(pIn, ToConv);
  802.   SendMessage(PBBSWIN, WM_COMMAND, 10020, longint(@pIn));
  803.   ToConv := StrPas(pIn);
  804. end;
  805.  
  806.  
  807. {-----------------------------------------------------------------------------}
  808. Procedure Change_Forum(PBBSWIN: HWND;
  809.                        InI:     Integer);
  810. { Change to Forum InI }
  811. var
  812.   pIn: Array[0..254] of char;
  813.  
  814. begin
  815.   StrPcopy(pIn, int_to_asc(InI));
  816.   SendMessage(PBBSWIN, WM_COMMAND, 10021, longint(@pIn));
  817. end;
  818.  
  819. {-----------------------------------------------------------------------------}
  820. Procedure Run_Menu_Command(PBBSWIN: HWND;
  821.                            InI:     Integer);
  822. { Run_Menu_Command InI }
  823. var
  824.   pIn: Array[0..254] of char;
  825.  
  826. begin
  827.   StrPcopy(pIn, int_to_asc(InI));
  828.   SendMessage(PBBSWIN, WM_COMMAND, 10022, longint(@pIn));
  829. end;
  830.  
  831. {-----------------------------------------------------------------------------}
  832. Procedure Run_PowerBase(PBBSWIN: HWND;
  833.                         InI:     Integer);
  834. { Run PowerBase InI }
  835. var
  836.   pIn: Array[0..254] of char;
  837.  
  838. begin
  839.   StrPcopy(pIn, int_to_asc(InI));
  840.   SendMessage(PBBSWIN, WM_COMMAND, 10023, longint(@pIn));
  841. end;
  842.  
  843. {-----------------------------------------------------------------------------}
  844. Procedure Back_Spaces(PBBSWIN:  HWND;
  845.                       Num:      Integer);
  846. { This procedure is used to back up and clear text.  For example you could
  847.   use: Press [ENTER]: then after ENTER is pressed, used this procedure to
  848.   back up }
  849. var
  850.   pIn: Array[0..254] of char;
  851.  
  852. begin
  853.   StrPcopy(pIn, int_to_asc(Num));
  854.   SendMessage(PBBSWIN, WM_COMMAND, 10025, longint(@pIn));
  855. end;
  856.  
  857. {-----------------------------------------------------------------------------}
  858. Procedure Send_File(PBBSWIN:  HWND;
  859.                     Fname:    string;
  860.                     mode:     integer);
  861. { Sends filename FNAME [be sure to include full path/filename!]
  862.   Mode:
  863.     1: zmodem
  864.     2: xmodem/crc
  865.     3: xmodem/1k
  866.     4: xmodem/1kg
  867.     5: ymodem
  868.     6: ymodemg }
  869. var
  870.   PIn: Array[0..254] of Char;
  871.   Outs: String;
  872.  
  873. begin {Send_File}
  874.   Outs := int_to_asc(mode)+'~'+Fname;
  875.   StrPcopy(pIn, Outs);
  876.   SendMessage(PBBSWIN, WM_COMMAND, 10026, longint(@pIn));
  877. end; {Send_File}
  878.  
  879.  
  880. {-----------------------------------------------------------------------------}
  881. Procedure Receive_File(PBBSWIN:  HWND;
  882.                        Fname:    string;
  883.                        mode:     integer);
  884. { Receives Fname.  Only uses the FILENAME in Fname.  The file
  885.   is placed in the transfer directory.  BBS_RECORD^.Transfer_Dir
  886.   Mode:
  887.     1: zmodem
  888.     2: xmodem/crc
  889.     3: xmodem/1k
  890.     4: xmodem/1kg
  891.     5: ymodem
  892.     6: ymodemg }
  893. var
  894.   PIn: Array[0..254] of Char;
  895.   Outs: String;
  896.  
  897. begin {Send_File}
  898.   Outs := int_to_asc(mode)+'~'+Fname;
  899.   StrPcopy(pIn, Outs);
  900.   SendMessage(PBBSWIN, WM_COMMAND, 10027, longint(@pIn));
  901. end; {Send_File}
  902.  
  903. Function Monitor_Mode(PBBSWIN: HWND): Char;
  904. { Returns the color mode:
  905.   'R' = RIP
  906.   'C' = ANSI
  907.   'M' = ASCII
  908.   Note that RIP is also ANSI compatible.
  909. }
  910. var
  911.   PIn: Array[0..10] of Char;
  912.  
  913. begin
  914.   SendMessage(PBBSWIN, WM_COMMAND, 10028, longint(@pIn));
  915.   Monitor_Mode := pIn[0];
  916. end;
  917.  
  918.  
  919. {-----------------------------------------------------------------------------}
  920. Procedure Get_UserRec(PBBSWIN:  HWND;
  921.                       var user: pPowrUser_Record);
  922. {
  923.   Gives you the pointer to the actual location of the user record in memory.
  924.   By changing the actual information in this record you are able to change
  925.   the current user information!  (BE CAREFUL ON WHAT YOU DO!)
  926. }
  927. var
  928.   pIn: array[0..254] of char;
  929.    pc: pchar;
  930.    pl: array[0..3] of byte absolute pc;
  931.  
  932. begin
  933.   SendMessage(PBBSWIN, WM_COMMAND, 10030, longint(@pIn));
  934.   pl[0] := byte(pIn[0]);
  935.   pl[1] := byte(pIn[1]);
  936.   pl[2] := byte(pIn[2]);
  937.   pl[3] := byte(pIn[3]);
  938.   user := pPowrUser_Record(pc);
  939. end;
  940.  
  941. {-----------------------------------------------------------------------------}
  942. Procedure Get_ForumUserRec(PBBSWIN:  HWND;
  943.                            var fuser:pPowrUser_Record_Extension);
  944. {
  945.   Gives you the pointer to the actual location of the user forum record in
  946.   memory.  This record contains the user's last read pointers along with
  947.   the information containing which forums the user has access to.
  948. }
  949. var
  950.   pIn: array[0..254] of char;
  951.    pc: pchar;
  952.    pl: array[0..3] of byte absolute pc;
  953.  
  954. begin
  955.   SendMessage(PBBSWIN, WM_COMMAND, 10031, longint(@pIn));
  956.   pl[0] := byte(pIn[0]);
  957.   pl[1] := byte(pIn[1]);
  958.   pl[2] := byte(pIn[2]);
  959.   pl[3] := byte(pIn[3]);
  960.   fuser := pPowrUser_Record_Extension(pc);
  961. end;
  962.  
  963. {-----------------------------------------------------------------------------}
  964. Procedure Get_CallInfo(PBBSWIN:  HWND;
  965.                        var cuser:pPower_CallInfo_Rec);
  966. var
  967.   pIn: array[0..254] of char;
  968.    pc: pchar;
  969.    pl: array[0..3] of byte absolute pc;
  970.  
  971. begin
  972.   SendMessage(PBBSWIN, WM_COMMAND, 10032, longint(@pIn));
  973.   pl[0] := byte(pIn[0]);
  974.   pl[1] := byte(pIn[1]);
  975.   pl[2] := byte(pIn[2]);
  976.   pl[3] := byte(pIn[3]);
  977.   cuser := pPower_CallInfo_Rec(pc);
  978. end;
  979.  
  980.  
  981. {-----------------------------------------------------------------------------}
  982. Procedure Get_Current_ForumInfo(PBBSWIN:  HWND;
  983.                                 var forum:pPowerBBS_Forum_Structure);
  984. var
  985.   pIn: array[0..254] of char;
  986.    pc: pchar;
  987.    pl: array[0..3] of byte absolute pc;
  988.  
  989. begin
  990.   SendMessage(PBBSWIN, WM_COMMAND, 10033, longint(@pIn));
  991.   pl[0] := byte(pIn[0]);
  992.   pl[1] := byte(pIn[1]);
  993.   pl[2] := byte(pIn[2]);
  994.   pl[3] := byte(pIn[3]);
  995.   forum := pPowerBBS_Forum_Structure(pc);
  996. end;
  997.  
  998. {-----------------------------------------------------------------------------}
  999. Procedure Get_BBS_Record(PBBSWIN:  HWND;
  1000.                         var bbs:   pBBS_Record);
  1001. var
  1002.   pIn: array[0..254] of char;
  1003.    pc: pchar;
  1004.    pl: array[0..3] of byte absolute pc;
  1005.  
  1006. begin
  1007.   SendMessage(PBBSWIN, WM_COMMAND, 10034, longint(@pIn));
  1008.   pl[0] := byte(pIn[0]);
  1009.   pl[1] := byte(pIn[1]);
  1010.   pl[2] := byte(pIn[2]);
  1011.   pl[3] := byte(pIn[3]);
  1012.   bbs := pBBS_Record(pc);
  1013. end;
  1014.  
  1015.  
  1016. {-----------------------------------------------------------------------------}
  1017. Procedure End_Call(PBBSWIN: HWND);
  1018. { End The Call }
  1019.  
  1020. begin
  1021.   SendMessage(PBBSWIN, WM_COMMAND, 10024, 0);
  1022. end;
  1023.  
  1024. {-----------------------------------------------------------------------------}
  1025. Function Search_UserName(PBBSWIN: HWND;
  1026.                          TheName: String): Integer;
  1027.  
  1028. { Searches the UserDatabase for TheName.  If not found, returns 0.
  1029.   If found, returns the record number that TheName is contained within. }
  1030.  
  1031. var
  1032.   PIn: array[0..254] of char;
  1033.  
  1034. begin
  1035.   strPcopy(PIn, TheName);
  1036.   SendMessage(PBBSWIN, WM_COMMAND, 10040, longint(@pIn));
  1037.   Search_UserName := asc_to_int(StrPas(pIn));
  1038. end;
  1039.  
  1040. {-----------------------------------------------------------------------------}
  1041. Procedure Load_UserRec(PBBSWIN:  HWND;
  1042.                        var user: pPowrUser_Record;
  1043.                        usernum:  integer);
  1044. {
  1045.   You must allocate memory for user before calling this routine!
  1046.   UserNum signifies the actual user record number (ask returned
  1047.   by Search_UserName)
  1048. }
  1049. var
  1050.   pIn: array[0..254] of char;
  1051.  
  1052. begin
  1053.   strPcopy(pIn, int_to_asc(usernum));
  1054.   SendMessage(PBBSWIN, WM_COMMAND, 10041, longint(@pIn));
  1055.   SendMessage(PBBSWIN, WM_COMMAND, 10042, longint(@(user^)));
  1056. end;
  1057.  
  1058.  
  1059. {-----------------------------------------------------------------------------}
  1060. Procedure Save_UserRec(PBBSWIN:  HWND;
  1061.                        var user: pPowrUser_Record;
  1062.                        usernum:  integer);
  1063. {
  1064.   You must allocate memory for user before calling this routine!
  1065.   UserNum signifies the actual user record number (ask returned
  1066.   by Search_UserName)
  1067. }
  1068. var
  1069.   pIn: array[0..254] of char;
  1070.  
  1071. begin
  1072.   strPcopy(pIn, int_to_asc(usernum));
  1073.   SendMessage(PBBSWIN, WM_COMMAND, 10041, longint(@pIn));
  1074.   SendMessage(PBBSWIN, WM_COMMAND, 10043, longint(@(user^)));
  1075. end;
  1076.  
  1077. {-----------------------------------------------------------------------------}
  1078. Procedure Close_ComPort(PBBSWIN: HWND);
  1079. { Closes the com port. }
  1080.  
  1081. begin
  1082.   SendMessage(PBBSWIN, WM_COMMAND, 10044, 0);
  1083. end;
  1084.  
  1085. {-----------------------------------------------------------------------------}
  1086. Procedure Open_ComPort(PBBSWIN: HWND);
  1087. { Opens up the Com Port. }
  1088.  
  1089. begin
  1090.   SendMessage(PBBSWIN, WM_COMMAND, 10045, 0);
  1091. end;
  1092.  
  1093. {-----------------------------------------------------------------------------}
  1094. Procedure HangUp_Caller(PBBSWIN: HWND);
  1095. { Attempts to hangup the caller.
  1096.   (Note that after 4 tries it gives up, if the caller is still on-line) }
  1097.  
  1098. begin
  1099.   SendMessage(PBBSWIN, WM_COMMAND, 10046, 0);
  1100. end;
  1101.  
  1102. {-----------------------------------------------------------------------------}
  1103. Function Number_Users_Online(PBBSWIN: HWND): integer;
  1104. { Returns the number of users currently on-line. }
  1105. { Only returns NON-ZERO nodes (So if a sysop has a BBS with a node 0 that
  1106.   node is not counted. }
  1107. var
  1108.   PIn: array[0..30] of char;
  1109.  
  1110. begin
  1111.   SendMessage(PBBSWIN, WM_COMMAND, 10047, longint(@PIn));
  1112.   Number_Users_Online := asc_to_int(StrPas(PIn));
  1113. end;
  1114.  
  1115. {-----------------------------------------------------------------------------}
  1116. {
  1117.   In order to send a message first call Init_Message with the header.
  1118.   Then call Message_Line TOTAL_LINES Number of times.  Each with the
  1119.   actual line of text for the message.
  1120.   Then call Save_Message.
  1121. }
  1122. Procedure Init_Message(PBBSWIN:     HWND;
  1123.                        From:        String90;  { Person Sending Message  }
  1124.                        Tou:         String90;  { Message destination     }
  1125.                        Topic:       String90;  { Subject of message      }
  1126.                        Total_Lines: Integer;   { Total lines in message  }
  1127.                        Forum_Num:   Integer;   { Forum number to save in }
  1128.                        Private:     Boolean);  { TRUE = Private message  }
  1129. var
  1130.   Pin: array[0..254] of char;
  1131.  
  1132. begin
  1133.   strPcopy(PIn, From+'~'+Tou+'~'+Topic+'~'+int_to_asc(Total_Lines)+'~'+
  1134.            int_to_asc(forum_num));
  1135.   if Private then
  1136.     strcat(PIn, 'Y')
  1137.   else
  1138.     strcat(PIn, 'N');
  1139.  
  1140.   SendMessage(PBBSWIN, WM_COMMAND, 10050, longint(@PIn));
  1141. end;
  1142.  
  1143. Procedure Message_Line(PBBSWIN:   HWND;
  1144.                        TheLine:   String);
  1145. var
  1146.   PIn: array[0..254] of char;
  1147.  
  1148. begin
  1149.   strPcopy(PIn, TheLine);
  1150.   SendMessage(PBBSWIN, WM_COMMAND, 10051, longint(@PIn));
  1151. end;
  1152.  
  1153. Procedure Save_Message(PBBSWIN: HWND);
  1154.  
  1155. begin
  1156.   SendMessage(PBBSWIN, WM_COMMAND, 10052, 0);
  1157. end;
  1158.  
  1159. {-----------------------------------------------------------------------------}
  1160. Procedure Set_Node_Description(PBBSWIN: HWND;
  1161.                                Doing:   String);
  1162. { Sets the WHO IS ONLINE RECORD to what the user is doing.
  1163.   Ex: Set_Node_Description(PBBSWIN, 'Using 3rd party door.'); }
  1164. var
  1165.   PIn: array[0..254] of char;
  1166.  
  1167. begin
  1168.   StrPcopy(PIn, Doing);
  1169.   SendMessage(PBBSWIN, WM_COMMAND, 10053, longint(@PIn));
  1170. end;
  1171.  
  1172. function is_user_online(PBBSWIN:  HWND;
  1173.                         thename:  string): boolean;
  1174. { Checks if THENAME is currently on-line as a user.  If THENAME is on-line
  1175.   returns TRUE }
  1176. var
  1177.   pIn: Array[0..254] of char;
  1178.  
  1179. begin
  1180.   strPcopy(pIn, thename);
  1181.   SendMessage(PBBSWIN, WM_COMMAND, 10054, longint(@PIn));
  1182.   Is_User_Online := (pIn[0] = 'Y');
  1183. end;
  1184.  
  1185. {-- Main DLL Module --}
  1186. {-- This procedure MUST be named as PowerBBS_Main.  PowerBBS assumes this
  1187.     procedure exists as this is the name that it calls when dynamically
  1188.     loading the DLL upon call from the BBS. ---}
  1189. Procedure PowerBBS_Main(PBBSWin: HWND); export;
  1190. var
  1191.   Inputs:  String;
  1192.   Counter: Byte;
  1193.   Puser:   pPowrUser_Record;
  1194.   Fuser:   pPowrUser_Record_Extension;
  1195.   Cuser:   pPower_CallInfo_Rec;
  1196.   forum:   pPowerBBS_Forum_Structure;
  1197.   bbs:     pBBS_Record;
  1198.   unum:    integer;
  1199.   Puser2:  pPowrUser_Record;
  1200.  
  1201. begin
  1202.   ClearScreen(PBBSWin);
  1203.   Write_ActLog(PBBSWIN, 'Entering Our Test .DLL!');
  1204.   Inputs := '|NAME|';
  1205.   Convert_MACROS(PBBSWIN, Inputs);
  1206.   PrintLn_Modem(PBBSWin, 'Welcome '+Inputs);
  1207.   PrintLn_Modem(PBBSWin, 'PowerDLL (c)1994 by Russell E. Frey');
  1208.   PrintLn_Modem(PBBSWin, 'This demo does NOTHING special, other than TEST the capabilities of the DLL.');
  1209.   PrintLn_Modem(PBBSWin, '');
  1210.   Print_Modem(PBBSWin, 'Run Demo? ');
  1211.   if not Get_YN(PBBSWIN) then exit;
  1212.   { Now Test Pause }
  1213.   for counter := 1 to 13 do
  1214.   begin
  1215.     PrintLn_Modem(PBBSWin, 'This module is a DLL linked dynamically to PowerBBS!');
  1216.     PrintLn_Modem(PBBSWin, 'Now easily write addons in C, C++, Pascal, or any other language');
  1217.     PrintLn_Modem(PBBSWin, 'Capable of making simple Windows API Calls.');
  1218.     if PauseStop(PBBSWIN) then exit;
  1219.     if No_User_Online(PBBSWIN) then exit;
  1220.   end;
  1221.   Print_Modem(PBBSWin, 'What do you like about this? ');
  1222.   Ask_User(PBBSWIN, Inputs, 20);
  1223.   PrintLn_Modem(PBBSWin, 'You inputted ['+Inputs+']');
  1224.  
  1225.   Print_Modem(PBBSWIN, 'Press ONE KEY:: ');
  1226.   Inputs[1] := Get_Key(PBBSWin);
  1227.   Back_Spaces(PBBSWIN, 17);
  1228.  
  1229.   if Get_YesNoQ(PBBSWIN,'Did you like this program?',TRUE) then
  1230.     Println_Modem(PBBSWIN, 'Thanks!')
  1231.   else
  1232.     PrintLn_Modem(PBBSWIN, 'Thats ok.  Oh BTW I just locked you out!');
  1233.   PrintLn_Modem(PBBSWIN, Inputs[1]);
  1234.   Print_Modem(PBBSWIN,'Press A B or C: ');
  1235.   Inputs[1] := Get_Hot(PBBSWIN, 'ABC');
  1236.   PrintLn_Modem(PBBSWIN, Inputs[1]);
  1237.   Type_File_To_Modem(PBBSWIN, 'C:\Autoexec.Bat');
  1238.   Print_Modem(PBBSWIN, 'Press ONE KEY (within one second):: ');
  1239.   Inputs[1] := Input_Key_Time(PBBSWin, 1000);
  1240.   if Inputs[1] = #255 then
  1241.     PrintLn_Modem(PBBSWIN, 'TimeOut!')
  1242.   else
  1243.     PrintLn_Modem(PBBSWIN, Inputs[1]);
  1244.   Send_modem_Command(PBBSWIN, '>>');
  1245.   {Execute_Prog(PBBSWIN, 'C:\TEMP.BAT');}
  1246.   if Key_Waiting(PBBSWIN) then
  1247.     PrintLn_Modem(PBBSWIN, 'Key Waiting')
  1248.   else
  1249.     PrintLn_Modem(PBBSWIN, 'NO KEY WAITING');
  1250.   Change_Forum(PBBSWIN, 3);
  1251.   Run_Menu_Command(PBBSWIN, 1);
  1252.   Run_PowerBase(PBBSWIN, 1);
  1253.   PrintLn_Modem(PBBSWin, 'Time Left: '+int_to_asc(Time_Left(PBBSWIN)));
  1254.  
  1255.   Get_UserRec(PBBSWin, pUser);
  1256.   PrintLn_Modem(PBBSWIN, 'Name = '+pUser^.Name);
  1257.   PrintLn_Modem(PBBSWIN, 'ZIP = '+pUser^.Zip);
  1258.  
  1259.   Get_ForumUserRec(PBBSWIN, Fuser);
  1260.   if (Fuser^.Forum_Data[3].Options and 1) <> 0 then
  1261.     PrintLn_Modem(PBBSWIN, ' You have access to forum #3!')
  1262.   else
  1263.     PrintLn_Modem(PBBSWIN, ' You do NOT have access to forum #3. <g>');
  1264.  
  1265.   Get_CallInfo(PBBSWIN, Cuser);
  1266.   PrintLn_Modem(PBBSWIN,'You are on at '+Cuser^.BaudRate+' bps! ');
  1267.  
  1268.   Get_Current_ForumInfo(PBBSWIN, forum);
  1269.   PrintLn_Modem(PBBSWIN,'Current Forum Name: '+forum^.forum_name);
  1270.  
  1271.   Get_BBS_Record(PBBSWIN, bbs);
  1272.   PrintLn_Modem(PBBSWIN, 'Opening File: '+bbs^.Opening);
  1273.   if Monitor_Mode(PBBSWIN) = 'R' then
  1274.     PrintLn_Modem(PBBSWIN, 'Using RIP')
  1275.   else
  1276.   if Monitor_Mode(PBBSWIN) = 'C' then
  1277.     PrintLn_Modem(PBBSWIN, 'Using ANSI')
  1278.   else
  1279.     PrintLn_Modem(PBBSWIN, 'Using ASCII');
  1280.  
  1281.   PrintLn_Modem(PBBSWIN, 'Rec # of GF = '+int_to_asc(Search_UserName(PBBSWIN,'GLEN FREY')));
  1282.   unum := Search_UserName(PBBSWIN, 'GLEN FREY');
  1283.   if unum <> 0 then
  1284.   begin
  1285.     getmem(pUser2, sizeof(pUser2^));
  1286.     Load_UserRec(PBBSWIN, pUser2, unum);
  1287.     PrintLn_Modem(PBBSWIN, 'Password = '+pUser2^.Password);
  1288.     pUser2^.Password[1] := 'N';
  1289.     Save_UserRec(PBBSWIN, pUser2, unum);
  1290.     freemem(pUser2, sizeof(pUser2^));
  1291.   end;
  1292.  
  1293.   Init_Message(PBBSWIN, 'SYSOP', 'TEST USER', 'Thanks!', 2, 0, FALSE);
  1294.   Message_Line(PBBSWIN, 'Hi Test User!');
  1295.   Message_Line(PBBSWIN, ' ... The SysOp ');
  1296.   Save_Message(PBBSWIN);
  1297.  
  1298.   Set_Node_Description(PBBSWIN, 'In PowerDLL');
  1299.   Inputs := '|WHO-ON|';
  1300.   Convert_Macros(PBBSWIN, Inputs);
  1301.  
  1302.   if Is_User_Online(PBBSWIN, 'GLEN FREY') then
  1303.     PrintLn_Modem(PBBSWIN, 'Glen is On-Line!');
  1304.  
  1305.   PrintLn_Modem(PBBSWIN, 'Number Users Online: '+int_to_asc(Number_Users_Online(PBBSWIN)));
  1306.   PrintLn_Modem(PBBSWin, 'Exiting to PowerBBS...');
  1307.   Get_Enter_Key(PBBSWIN);
  1308.   {End_Call(PBBSWIN);}
  1309. end;
  1310.  
  1311.   exports
  1312.     PowerBBS_Main index 1;
  1313.  
  1314. begin
  1315. end.
  1316.